package com.qumitech.visualnovel.controller.rest;

import com.qumitech.visualnovel.model.common.BaseRsp;
import com.qumitech.visualnovel.pubdef.dto.voiceroom.VoiceRoomAutoEnterCfgDTO;
import com.qumitech.visualnovel.service.voiceRoom.VoiceRoomAutoEnterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/voiceroom/auto/enter")
public class VoiceRoomAutoEnterController {
    @Autowired
    private VoiceRoomAutoEnterService autoEnterService;

    @PostMapping("/cfg")
    public BaseRsp saveAutoEnterCfg(@RequestBody VoiceRoomAutoEnterCfgDTO cfgDTO){
        return autoEnterService.saveCfg(cfgDTO);
    }

    @DeleteMapping("/cfg/id/{id}")
    public BaseRsp rmAutoEnterCfg(@PathVariable("id") long id){
        return autoEnterService.rmCfg(id);
    }

    @GetMapping("/cfg")
    public BaseRsp listAutoEnterCfg(@RequestParam(value = "sub_channel", required = false) String subChannel){
         return autoEnterService.listCfg(subChannel);
    }
}
